<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/jquery.min.js"></script>
		<script src="js/bootstrap.min.js"></script>
		<link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css"/>
		<script >
			function checkid(){
				sidvalue =$("#studentid").val();
				regExp = /^[0-9]{9} $/;
				if(!regExp.test(sidvalue)){
					$("#studentid").css("border","1px solid red");
					return false;
				}
				else{
					$("#studentid").css("border","");
					return true;
				}
			}
			function checkname(){
				sname =$("#sname").val();
				regExp=/^[\u4E00-\u9FA5]{2-4}$/;
				if(!regExp.test(sname)){
					$("#sname").css("border","1px solid red");
					return false;
				}
				else{
					$("#sname").css("border","");
					return true;
				}
			}
			function checkAll(){
				flag1=checkid();
				flag2=checkname();
				return flag1 && flag2;
			}
		</script>
	</head>
	<body>
		学号<input onblur="checkid()" class="form-control" type="text" id="studentid"/><br />
		姓名<input onblur="checkname()" class="form-control" type="text" id="sname"/><br />
		<button onclick="checkAll()" class="btn btn-block btn-danger">注册</button>
	</body>
</html>
